home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / misc / tasm / tasm.doc < prev    next >
Text File  |  1996-09-05  |  71KB  |  1,697 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                          TASM USER'S MANUAL
  8.  
  9.  
  10.    TASM - A Table Driven Cross Assembler for the MSDOS* Environment
  11.  
  12.  
  13.  
  14.  
  15.  
  16.                            Thomas N. Anderson
  17.                      Speech Technology Incorporated
  18.                 837 Front Street South, Issaquah, WA   98027
  19.  
  20.  
  21.                             August, 1990
  22.                              Version 2.8
  23.  
  24. [Speech Technology Incorporated  manufactures electronic devices  to
  25. aid  the  visually  impaired  employing  digital  speech   synthesis
  26. technology.]
  27.  
  28.  
  29. TASM software  is  Copyright  (C)  1985-1990  by  Speech  Technology
  30. Incorporated.  All rights reserved.
  31.  
  32. This document  is  Copyright  (C)  1985-1990  by  Speech  Technology
  33. Incorporated.  All rights reserved.   Permission is granted to  copy
  34. this document and related software except for the source code.   The
  35. source code, distributed to registered users, may be copied for  the
  36. sole use of the registered user.
  37.  
  38. Portions  of  TASM.EXE (C runtime library)  are Copyright  1987   by
  39. Microsoft Corporation.
  40.  
  41.  
  42.  
  43.  * MSDOS is a trademark of Microsoft Corporation.
  44.  
  45. TASM - Table Driven Assembler Version 2.8                     Page 2
  46.  
  47. TABLE OF CONTENTS
  48.  
  49. SECTION                                             PAGE
  50. ______________________________________________________________________
  51. INTRODUCTION                                           4
  52. INVOCATION                                             5
  53.  File Names                                            5
  54.  Option: a - Assembly Control                          6
  55.  Option: b - Binary Object Format                      7
  56.  Option: c - Contiguous Block Output                   7
  57.  Option: d - Define a Macro                            7
  58.  Option: e - Expand Source                             7
  59.  Option: f - Fill Memory                               7
  60.  Option: g - Select Object File Format                 8
  61.  Option: h - Hex Object Code Table                     8
  62.  Option: i - Ignore Case in Labels                     8
  63.  Option: l - Label Table                               8
  64.  Option: m - MOS Technology Object Format              8
  65.  Option: o - Set Number of Bytes per Object Record     8
  66.  Option: p - Page Listing File                         8
  67.  Option: q - Disable Listing File                      8
  68.  Option: r - Set Read Buffer Size                      8
  69.  Option: s - Enable Symbol File Generation             9
  70.  Option: t - Table Name                                9
  71.  Option: x - Enable Extended Instruction Set          10
  72.  Option: y - Enable Assembly Timing                   10
  73. ENVIRONMENT VARIABLES                                 11
  74.  TASMTABS                                             11
  75.  TASMOPTS                                             10
  76. EXIT CODES                                            10
  77. SOURCE FILE FORMAT                                    12
  78. EXPRESSIONS                                           13
  79.  Labels                                               13
  80.  Numeric Constants                                    13
  81.  Character Constants                                  14
  82.  String Constants                                     14
  83.  Location Counter Symbol                              14
  84.  Operators                                            14
  85. ASSEMBLER DIRECTIVES                                  17
  86.  ADDINSTR                                             17
  87.  AVSYM                                                17
  88.  BLOCK                                                17
  89.  BSEG/CSEG/DSEG/NSEG/XSEG                             17
  90.  BYTE                                                 18
  91.  CODES/NOCODES                                        18
  92.  DB                                                   18
  93.  DW                                                   18
  94.  DEFINE                                               18
  95.  DEFCONT                                              19
  96.  EJECT                                                19
  97.  ELSE                                                 20
  98.  END                                                  20
  99.  ENDIF                                                20
  100.  EQU                                                  20
  101.  EXPORT                                               21
  102.  IFDEF                                                21
  103. TASM - Table Driven Assembler Version 2.8                     Page 3
  104.  
  105.  IFNDEF                                               21
  106.  IF                                                   22
  107.  INCLUDE                                              22
  108.  LIST/NOLIST                                          22
  109.  LSFIRST/MSFIRST                                      22
  110.  ORG                                                  22
  111.  PAGE/NOPAGE                                          23
  112.  SET                                                  23
  113.  SYM/AVSYM                                            23
  114.  TEXT                                                 24
  115.  TITLE                                                25
  116.  WORD                                                 25
  117. OBJECT FILE FORMATS                                   26
  118.  Intel Hex Object Format                              26
  119.  MOS Technology Hex Object Format                     27
  120.  Motorola Hex Object Format                           27
  121.  Binary Object Format                                 28
  122. LISTING FILE FORMAT                                   29
  123. PROM PROGRAMMING                                      30
  124. ERROR MESSAGES                                        31
  125. BUGS AND LIMITATIONS                                  34
  126.  
  127. APPENDIX A - ORDERING INFORMATION                     35
  128. TASM - Table Driven Assembler Version 2.8                     Page 4
  129.  
  130. INTRODUCTION
  131.  
  132.  
  133. TASM is a table driven  cross assembler for the MS-DOS  environment.
  134. Assembly source code, written in the appropriate dialect  (generally
  135. very close to the manufacturers assembly language), can be assembled
  136. with TASM, and the resulting  object code transferred to the  target
  137. microprocessor system via PROM or other mechanisms.
  138.  
  139. The current microprocessor families supported by TASM are:
  140.  
  141.         6502                       8048
  142.         6800/6801                  8051
  143.         6805                       8080/8085
  144.         TMS32010                   Z80
  145.         TMS7000
  146.  
  147. The user so inclined may build tables for other microprocessors. The
  148. descriptions of  the various  existing  tables and  instructions  on
  149. building new tables are not in this document but can be found in the
  150. TASMTABS.DOC file on the TASM distribution disk.
  151.  
  152. TASM characteristics include:
  153.  
  154.   1.  Powerful expression parsing (17 operators).
  155.   2.  Supports a subset of the 'C' preprocessor commands.
  156.   3.  Macro capability (through use of DEFINE directive).
  157.   4.  Multiple statements per line.
  158.   5.  Four object file formats:
  159.           Intel hex, MOS Technology hex, Motorola hex, binary.
  160.   6.  Absolute code generation only.
  161.   7.  Source code available (in C).
  162.   8.  Uniform syntax  across  versions  for  different  target machines.
  163.   9.  Features in support of PROM programming (preset memory,
  164.           contiguous block).
  165.   10. Supports extended instructions for many of the supported
  166.           microprocessor families.
  167.   11. Tables read at run time - single TASM executable for all
  168.           table versions.
  169.   12. Symbol table export for inclusion in subsequent assemblies
  170.           (.EXP format).
  171.   13. Symbol table export file compatible with the Avocet 8051
  172.           simulator (.SYM format).
  173.  
  174. SHAREWARE
  175.  
  176. TASM is distributed as shareware.   TASM is not public domain.   The
  177. TASM distribution files may be  freely copied (excluding the  source
  178. code files)  and  freely used  for  the purpose  of  evaluating  the
  179. suitability of  TASM for  a given  purpose.   Use of  TASM beyond  a
  180. reasonable evaluation period requires registration.   Prolonged  use
  181. without registration is unethical.
  182.  
  183. TASM - Table Driven Assembler Version 2.8                     Page 5
  184.  
  185. INVOCATION
  186.  
  187. TASM can be invoked as  follows (optional fields shown in  brackets,
  188. symbolic fields in <>):
  189.  
  190.     tasm -<pn> [-<option_flag ...>] <src_file> [<obj_file>
  191.                                [<lst_file> [<exp_file> [<sym_file>]]]]
  192.  
  193.     Where  <option_flag> can be one or more of the following:
  194.  
  195.     -<table>        Specify version (<table> = table designation)
  196.     -t<table>       Table (alternate form of above)
  197.     -a<amask>       Assembly control (optional error checking)
  198.     -b              Produce object in binary (.COM) format
  199.     -c              Object file written as a contiguous block
  200.     -d<macro>       Define a macro (or just a macro label)
  201.     -e              Show source lines after macro expansion
  202.     -f<fillbyte>    Fill entire memory space with <fillbyte> (hex)
  203.     -g<objtype>     Object file (0=Intel, 1=MOS Tech, 2=Motorola, 3=binary)
  204.     -h              Produce hex table of the assembled code (in list file)
  205.     -i              Ignore case for labels
  206.     -l              Produce a label table in the listing
  207.     -m              Produce object in MOS Technology format
  208.     -o<obytes>      Bytes per object record (for hex obj formats)
  209.     -p[<lines>]     Page the listing file (<lines per page>. default=60)
  210.     -q              Quiet, disable the listing file
  211.     -r<kb>          Set read buffer size in Kbytes (default 2 Kbytes)
  212.     -s              Write a symbol table file
  213.     -x[<xmask>]     Enable extended instruction set (if any)
  214.     -y              Time the assembly
  215.  
  216. The file parameters are defined as follows:
  217.  
  218. <src_file>  Source file name
  219. <obj_file>  Object code file name
  220. <lst_file>  Listing file name
  221. <exp_file>  Symbol export file (only if the EXPORT directive is used).
  222. <sym_file>  Symbol table file  (only if the "-s"
  223.                 option or the SYM/AVSYM directives are used).
  224.  
  225. The source file must be specified.   If not, some usage  information
  226. is displayed.   Default  file  names for  all  the other  files  are
  227. generated if  they are  not explicitly  provided.   The filename  is
  228. formed by taking the source  filename and changing the extension  to
  229. one of the following:
  230.  
  231. Extension           File type
  232. ________________________________________________________
  233. .OBJ                Object file
  234. .LST                Listing file
  235. .EXP                Symbol export file
  236. .SYM                Symbol table  file
  237.  
  238. TASM has  no  built-in  instruction set  tables.    Instruction  set
  239. definition files are read at run time.  TASM determines which  table
  240. to use based  on the '-table'  field shown above.   For example,  to
  241. TASM - Table Driven Assembler Version 2.8                     Page 6
  242.  
  243. assemble the code in a file called source.asm, one would enter:
  244.  
  245.         tasm -48  source.asm            for an 8048 assembly
  246.         tasm -65  source.asm            for a  6502 assembly
  247.         tasm -51  source.asm            for an 8051 assembly.
  248.         tasm -85  source.asm            for an 8085 assembly.
  249.         tasm -80  source.asm            for a  Z80  assembly.
  250.         tasm -05  source.asm            for a  6805 assembly.
  251.         tasm -68  source.asm            for a  6800/6801 assembly.
  252.         tasm -70  source.asm            for a  TMS7000  assembly.
  253.         tasm -32  source.asm            for a  TMS32010 assembly.
  254.  
  255. The file name that the tables are read from is formed by taking  the
  256. digits specified  after the  '-'  and appending  it to  'TASM'  then
  257. appending the '.TAB' extension.   Thus, the  '-48' flag would  cause
  258. the tables to be read from the file 'TASM48.TAB'.
  259.  
  260. It is possible to  designate tables by non  numeric part numbers  if
  261. the '-t' flag is used.  For example, if a user built a table  called
  262. TASMF8.TAB then TASM could be invoked as follows:
  263.  
  264.         tasm -tf8 source.asm
  265.  
  266. Each option  flag must  be preceded  by a  dash.   Options need  not
  267. precede the file names, however.  The various options are  described
  268. below:
  269.  
  270. a - Assembly Control. TASM can provide additional error checking  by
  271. specifying the '-a' option at the time of execution.  If the '-a' is
  272. provided without a  digit following,  then all  the available  error
  273. checking is done.  If a digit follows, then it is used as a mask  to
  274. determine the error checks  to be made.   The bits  of the mask  are
  275. defined as follows:
  276.  
  277. Bit   Option   Description
  278. __________________________________________________________________
  279. 0     -a1      Check for apparent illegal use of indirection
  280. 1     -a2      Check for unused data in the arguments
  281. 2     -a4      Check for duplicate labels
  282. 3     -a8      Check for non-unary operators at start of expression.
  283. 4     -a10     Check for off-page jumps for 8051 ACALL/AJMP.
  284.  
  285. Combinations of the above bits can also be used.  For example, '-a5'
  286. would enable  the checking  for  illegal indirection  and  duplicate
  287. labels.
  288.  
  289. Illegal indirection applies to micros that use parenthesis around an
  290. argument to indicate indirection.  Since  it is always legal to  put
  291. an extra pair of  parenthesis around any expression  (as far as  the
  292. expression parser is concerned), the  user may think that he/she  is
  293. indicating indirection for  an instruction that  has no  indirection
  294. and TASM would not complain.  Enabling this checking will result  in
  295. an error message (warning) whenever an outer pair of parenthesis  is
  296. used and the  instruction set definition  table does not  explicitly
  297. indicate that to be a valid form of addressing.
  298.  
  299. TASM - Table Driven Assembler Version 2.8                     Page 7
  300.  
  301. Unused data in  arguments applies to  cases where a  single byte  of
  302. data is needed from an argument, but the argument contains more than
  303. one byte of data.  If a full sixteen bit address is used in a  'Load
  304. Immediate' type  instruction  that needs  only  a single  byte,  for
  305. example, an error message  would be generated.   Here is an  example
  306. (6502 code):
  307.  
  308. 0001   1234                    .org $1234
  309. tasm: Unused data in MS byte of argument.  Line 0002 in test.asm
  310. 0002   1234 A9 34       start  lda  #start
  311.  
  312. To make the above  checks occur whenever you  do an assembly, add  a
  313. line like this to your AUTOEXEC.BAT file:
  314.  
  315.         SET TASMOPTS=-a
  316.  
  317.  
  318. b  -  Binary Object Format. This option causes the object file to be
  319. written in binary - one byte for each byte of code/data.  Note  that
  320. no address  information  is included  in  the object  file  in  this
  321. format.  The contiguous block (-c)  output mode is forced when  this
  322. option is invoked.  This flag is equivalent to '-g3'.
  323.  
  324. c - Contiguous Block Output. If  this option is specified, then  all
  325. bytes in the range from the lowest used byte to the highest will  be
  326. defined in the object  file.  Normally, with  the default Intel  Hex
  327. object format enabled,  if the  Program Counter  (PC) jumps  forward
  328. because of an .ORG directive, the  bytes skipped over will not  have
  329. any value  assigned them  in  the object  file.   With  this  option
  330. enabled, no output to  the object file occurs  until the end of  the
  331. assembly at which time the whole  block is written.  This is  useful
  332. when using TASM to  generate code that  will be put  into a PROM  so
  333. that all locations will  have a known value.   This option is  often
  334. used in conjunction with  the -f option to  ensure all unused  bytes
  335. will have a known value.
  336.  
  337. d - Define a Macro. Macros are defined on the command line generally
  338. to control the assembly  of various IFDEF's that  are in the  source
  339. file.  This  is a  convenient way  to generate  various versions  of
  340. object code from a single source file.
  341.  
  342. e - Expand  Source. Normally TASM  shows lines in  the listing  file
  343. just as they are in the source file.  If macros are in use (via  the
  344. DEFINE directive) it is sometimes desirable to see the source  lines
  345. after expansion.  Use the '-e' flag to accomplish this.
  346.  
  347. f  -  Fill  Memory.  This  option  causes the memory image that TASM
  348. maintains to be initialized  to the value specified  by the two  hex
  349. characters immediately following the 'f'.   TASM maintains a  memory
  350. image that is a full 64K bytes in size (even if the target processor
  351. cannot   utilize that  memory  space).   Invocation of  this  option
  352. introduces a delay at start up of up to 2 seconds (time required  to
  353. initialize all 64K bytes).
  354.  
  355. g -  Object File  Format.  TASM can  generate  object code  in  four
  356. different formats as indicated below:
  357. TASM - Table Driven Assembler Version 2.8                     Page 8
  358.  
  359.         -g0    for Intel hex (default)
  360.         -g1    for MOS Technology hex (same as -m)
  361.         -g2    for Motorola hex
  362.         -g3    for binary (same as -b)
  363.  
  364. The '-m' and '-b' flags may also be used, as indicated above.
  365.  
  366. See the section on OBJECT FILE  FORMATS for descriptions of each  of
  367. the above.
  368.  
  369.  
  370. h - Hex Object  Code Table. This  option causes a  hex table of  the
  371. produced object code to  appear in the listing  file.  Each line  of
  372. the table shows sixteen bytes of code.
  373.  
  374.  
  375. i - Ignore  Case in Labels.   TASM is  normally case sensitive  when
  376. dealing with labels.  For those that prefer case insensitivity,  the
  377. '-i' command line option can be employed.
  378.  
  379. l - Label Table.  This option causes a label table to appear in  the
  380. listing file.   Each label  is shown with  its corresponding  value.
  381. Macro labels  (as  established via  the  DEFINE directives)  do  not
  382. appear.
  383.  
  384. m - MOS Technology Object Format. This option causes the object file
  385. to be written in MOS Technology  hex format rather than the  default
  386. Intel hex  format.    See  section on  OBJECT  FILE  FORMATS  for  a
  387. description of the format.
  388.  
  389. o - Set Number of Bytes per Object Record.  When  generating  object
  390. code in either the MOS Technology format or the Intel hex format,  a
  391. default of 24 (decimal) bytes of object are defined on each  record.
  392. This can be altered by invoking the '-o' option immediately followed
  393. by  two  hex digits defining the number of bytes per record desired.
  394. For example,  if 32 bytes per record are desired,  one might  invoke
  395. TASM as:
  396.  
  397.         TASM -48 -o20 source.asm
  398.  
  399. p - Page Listing File. This  option causes the listing file to  have
  400. top of page headers and form feeds inserted at appropriate intervals
  401. (every sixty lines  of output).   To override the  default of  sixty
  402. lines per page, indicate the desired  number of lines per page as  a
  403. decimal number immediatly following the '-p'.  Here is an example:
  404.  
  405.         TASM -48 -p56 source.asm
  406.  
  407. q - Disable  Listing File.   This option  causes all  output to  the
  408. listing file  to  be    suppressed,  unless  a  .LIST  directive  is
  409. encountered in the source file (see LIST/NOLIST directives).
  410.  
  411. r - Set  Read Buffer Size.  This option overrides  the default  read
  412. buffer size of 2  Kbytes.  The  first hexadecimal digit  immediately
  413. after the 'r' is taken as the number of K bytes to allocate for  the
  414. read  buffer  (.e.g.  '-r8'  indicates  an  8K  byte  buffer,  '-rf'
  415. TASM - Table Driven Assembler Version 2.8                     Page 9
  416.  
  417. indicates a 15K byte buffer).  Note that that read buffers are taken
  418. from the same  memory pool  as labels  and macro  storage, and  that
  419. additional read buffers are  needed if "includes"  are used.   Thus,
  420. using 8K  byte buffers  may  be suitable  for most  assemblies,  but
  421. programs with large numbers of symbols  may not allow such a  value.
  422. Also, reducing the buffer  size to 1 Kbyte  can increase the  memory
  423. pool available for label storage, if such is needed.
  424.  
  425. s - Enable Symbol File Generation.    If this flag is set, a  symbol
  426. file is generated at  the end of  the assembly.   The format of  the
  427. file is one line  per label, each label  starts in the first  column
  428. and is  followed by  white space  and then  four hexadecimal  digits
  429. representing the value of the label.   The following illustrates the
  430. format:
  431.  
  432.         label1         FFFE
  433.         label2         FFFF
  434.         label3         1000
  435.  
  436. The symbol file name can be provided  as the fifth file name on  the
  437. the command line, or the name will be generated from the source file
  438. name with a  '.SYM' extension.   The symbol table  file can also  be
  439. generated by invoking the SYM  directive.  The AVSYM directive  also
  440. generates the symbol file but in a different format (see section  on
  441. ASSEMBLER DIRECTIVES).
  442.  
  443. t - Table Name.  As an alternative to specifying the instruction set
  444. table as two decimal digits,  the table indication may be  preceeded
  445. by the '-t' option.  This is useful if the desired table name starts
  446. with a non-numeric.  Thus, a table for an F8 might be selected as:
  447.  
  448.         TASM -tf8 source.asm
  449.  
  450. TASM would expect to read the instruction set definition tables from
  451. a file named TASMF8.TAB.
  452.  
  453. TASM - Table Driven Assembler Version 2.8                    Page 10
  454.  
  455. x -  Enable Extended  Instruction  Set. If  a processor  family  has
  456. instructions that are  valid for only  certain members, this  option
  457. can be used to  enable those beyond  the basic standard  instruction
  458. set.  A hex digit may follow  the 'x' to indicate a mask value  used
  459. in selecting the  appropriate instruction set.   Bit 0  of the  mask
  460. selects the  basic  instruction set,  thus  a '-x1'  would  have  no
  461. effect.    A  '-x3'  would  enable  the  basic  set  plus   whatever
  462. instructions have bit 1 set in their  class mask.  A '-x' without  a
  463. digit following is equivalent to a '-xf' which sets all four of  the
  464. mask bits.  The  following  table  indicates  the  current  extended
  465. instruction sets available in the TASM tables:
  466.  
  467.               Base          Extension 1     Extension 2  Extension 3
  468. Base Table    Family        (-x3)           (-x5)        (-x9)
  469. ____________________________________________________________________
  470. TASM48.TAB    8048          8041A           8022          8021
  471. TASM65.TAB    6502          R65C02          R65C00/21
  472. TASM05.TAB    6805          M146805 CMOS    HC05C4
  473. TASM80.TAB    Z80           HD64180
  474. TASM68.TAB    6800          6801/6803
  475. TASM51.TAB    8051          
  476. TASM85.TAB    8080          
  477. TASM32.TAB    TMS32010      
  478. TASM70.TAB    TMS7000       
  479.  
  480. The above table  does not  attempt to show  the many  microprocessor
  481. family members that may apply under a given column.
  482.  
  483. y - Enable  Assembly Timing.   If this option  is enabled TASM  will
  484. generate a statement of elapsed time and assembled lines per  second
  485. at the end of the assembly.
  486.  
  487. TASM - Table Driven Assembler Version 2.8                    Page 11
  488.  
  489. ENVIRONMENT VARIABLES
  490.  
  491. The TASM  environment  can be  customized  by using  the  enviroment
  492. variables listed below:
  493.  
  494. TASMTABS. This variable specifies the  path to be searched for  TASM
  495. instruction set definition tables.   If it is  not defined then  the
  496. table(s) must exist  in the current  working directory.   If it  was
  497. desired to put the instruction set definition tables in a  directory
  498. called 'TASM' on a drive called 'C:', the following statement  would
  499. be appropriate in the AUTOEXEC.BAT file:
  500.  
  501.         set TASMTABS=C:\TASM
  502.  
  503. TASMOPTS. This variable specifies TASM command line options that are
  504. to be invoked every time TASM is executed.  For example, if TASM  is
  505. being used  for  8048  assemblies with  binary  object  file  output
  506. desired,  the  following  statement  would  be  appropriate  in  the
  507. AUTOEXEC.BAT file:
  508.  
  509.         set TASMOPTS=-48 -b
  510.  
  511.  
  512. EXIT CODES
  513.  
  514. When TASM  terminates, it  will  return to  DOS the  following  exit
  515. codes:
  516.  
  517. Exit Code      Meaning
  518. ___________________________________________________________
  519. 0              Normal completion, no assembly errors
  520. 1              Normal completion, with assembly errors
  521. 2              Abnormal completion, insufficient memory
  522. 3              Abnormal completion, file access error
  523. 4              Abnormal completion, general error
  524.  
  525.  
  526. Exit codes 2 and above will  also be accompanied by messages to  the
  527. console concerning the error.
  528.  
  529. TASM - Table Driven Assembler Version 2.8                    Page 12
  530.  
  531. SOURCE FILE FORMAT
  532.  
  533. Statements in the source  file must conform to  a format as  follows
  534. (except  for assembler directive statements which are described in a
  535. subsequent section):
  536.  
  537.         label  operation    operand       comment
  538.  
  539. All of the fields are optional, under appropriate circumstances.  An
  540. arbitrary amount of white space  (space and tabs) can separate  each
  541. field (as long as the maximum  line length of 255 characters is  not
  542. exceeded).  Each of the fields are described below:
  543.  
  544. Label Field. If the first character of the line is alphabetic, it is
  545. assumed to  be the  start of  a label.   Subsequent  characters  are
  546. accepted as  part  of that  label  until a  space,  tab, or  ':'  is
  547. encountered.    The   assembler  assigns  a   value  to  the   label
  548. corresponding to  the current  location counter.   Labels  can be  a
  549. maximum of 13 characters long.   Labels can contain upper and  lower
  550. case letters, digits, underscores, and periods (the first  character
  551. must be alphabetic).  Labels are case sensitive - the label  'START'
  552. is a different label  from 'start' - unless  the '-i' (ignore  case)
  553. option is enabled.
  554.  
  555. Operation  Field.  The  operation  field  contains  an   instruction
  556. mnemonic which specifies the action to be carried out by the  target
  557. processor when this instruction is executed.  The interpretation  of
  558. each  mnemonic  is  dependent  on  the  target  microprocessor   (as
  559. indicated by  the selected  TASM table).   The  operation field  may
  560. begin in any column except the  first.  The operation field is  case
  561. insensitive.
  562.  
  563. Operand Field. The operand field  specifies the data to be  operated
  564. on by the instruction.   It may  include expressions and/or  special
  565. symbols describing  the addressing  mode  to be  used.   The  actual
  566. format and interpretation is dependent on the target processor.  For
  567. a description of the format for currently supported processors,  see
  568. the TASMTABS.DOC file on the TASM distribution disk.
  569.  
  570. Comment Field.  The  comment field always  begins with a  semicolon.
  571. The rest of the line  from the semicolon to the  end of the line  is
  572. ignored by TASM, but  passed on to the  listing file for  annotation
  573. purposes.  The comment field must be  the last field on a line,  but
  574. it may be the only field, starting in column one, if desired.
  575.  
  576. Multiple    Statement  Lines.     If  the  backslash  character   is
  577. encountered on a  source line,   it is  treated as a  newline.   The
  578. remainder of the line  following  the  backslash  will be  processed
  579. as an  independent line  of source  code.   This allows  one to  put
  580. multiple statements  on a line.   This facility is not so useful  of
  581. itself,  but  when coupled  with the  capability   of   the   DEFINE
  582. directive,    powerful    multiple  statement    macros    can    be
  583. constructed  (see   section   on ASSEMBLER DIRECTIVES).   Note  that
  584. when  using  the  statement  separator,  the character   immediately
  585. following  it  should be  considered the  first character  of a  new
  586. line,  and thus must  either be a start of  a label or  white  space
  587. TASM - Table Driven Assembler Version 2.8                    Page 13
  588.  
  589. (not an instruction).  As the examples show, a space is put  between
  590. the backslash and the start of the next instruction.
  591.  
  592.  
  593. Some  examples  of  valid  source  statements follow (6502 mnemonics
  594. shown):
  595.  
  596. label1   lda      byte1   ;get the first byte
  597.          dec      byte1
  598.          jne      label1
  599.                   
  600. ;                 
  601. label2            
  602.          sta      byte2,X
  603.          ;        a multiple statement line follows
  604.          lda      byte1\ sta byte1+4\ lda byte2\ sta byte2+4
  605.  
  606.  
  607.  
  608. EXPRESSIONS
  609.  
  610. Expressions are  made  up  of various  syntactic  elements  (tokens)
  611. combined according to a  set of syntactical rules.   The tokens  are
  612. summarized as follows:
  613.  
  614.         1.  Labels
  615.         2.  Constants
  616.         3.  Location Counter Symbol
  617.         4.  Operators
  618.         5.  Parenthesis
  619.  
  620. Labels. Labels are strings of  characters that have a numeric  value
  621. associated with them, generally representing an address.  Labels can
  622. contain upper  and  lower  case letters,  digits,  underscores,  and
  623. periods.  The first  character must be a  letter (to distinguish  it
  624. from a numeric constant).  The value of a label is limited to 32 bit
  625. precision.  Labels can contain up to 13 characters, all of which are
  626. significant (none are ignored when looking at a label's value, as in
  627. some assemblers).   Case is significant unless the '-i' command line
  628. option is invoked.
  629.  
  630. Numeric Constants.  Numeric  constants  must  always  begin  with  a
  631. decimal digit (thus hexadecimal constants  that start with a  letter
  632. must be prefixed by a '0' unless the '$' prefix is used).  The radix
  633. is determined by  a letter  immediately following  the digit  string
  634. according to the following table:
  635.  
  636.        Radix          Suffix                   Prefix
  637.        ______________________________________________________
  638.        2              B or b                   %
  639.        8              O or o                   @
  640.        10             D or d (or nothing)      
  641.        16             H or h                   $
  642.  
  643. Decimal is the default radix, so decimal constants need no suffix or
  644. prefix.
  645. TASM - Table Driven Assembler Version 2.8                    Page 14
  646.  
  647. The following representations are equivalent:
  648.  
  649.        1234H          or     $1234
  650.        100d           or     100
  651.        177400O        or     @177400
  652.        01011000b      or     %01011000
  653.  
  654. The prefixes are provided for  compatibility with some other  source
  655. code formats but introduce a problem of ambiguity.  Both '%' and '$'
  656. have alternate  uses  ('%'  for modulo,  '$'  for  location  counter
  657. symbol).  The ambiguity is resolved  by examining the context.   The
  658. '%' character is interpreted as the modulo operator only if it is in
  659. a postion suitable for  a binary operator.  Similarly, if the  first
  660. character following  a  '$' is  a  valid hexadecimal  digit,  it  is
  661. assumed to be a radix specifier and not the location counter.
  662.  
  663. Character  Constants.  Character  constants  are  single  characters
  664. surrounded by  single quotes  (following quote  is optional).    The
  665. ASCII value of the character in  the quotes is returned.  No  escape
  666. provision exists to  represent non-printable  characters within  the
  667. quotes, but this is not necessary since these can be just as  easily
  668. represented as numeric constants (or using the TEXT directive  which
  669. does allow escapes).
  670.  
  671. String Constants.  String  constants  are  one  or  more  characters
  672. surrounded by double  quotes.   Note that string  constants are  not
  673. allowed in expressions. They are only allowable following the TITLE,
  674. BYTE and  TEXT assembler  directives. The  quoted strings  may  also
  675. contain  escape  sequences  to  put  in  unprintable  values.    The
  676. following escape sequences are supported:
  677.  
  678.         Escape
  679.         Sequence       Description
  680.         ___________________________________________________________
  681.         \n             Line Feed
  682.         \r             Carriage return
  683.         \b             Backspace
  684.         \t             Tab
  685.         \f             Formfeed
  686.         \\             Backslash
  687.         \"             Quote
  688.         \000           Octal value of character
  689.  
  690. Location   Counter   Symbol.    The  current value  of the  location
  691. counter (PC) can  be used  in expressions by  placing a  '$' in  the
  692. desired place.  The Location Counter Symbol is allowable anywhere  a
  693. numeric constant is.  (Note that if the '$' is followed by a decimal
  694. digit then  it is    taken to  be  the hexadecimal  radix  indicator
  695. instead of the Location  Counter symbol, as  mentioned above).   The
  696. '*' may also be used to represent the location counter, but is  less
  697. preferred because of its ambiguity with the multiplicative operator.
  698.  
  699. Operators. Expressions can optionally  contain operators to  perform
  700. some alterations  or  calculations  on  particular  values.      The
  701. operators are summarized as follows:
  702.  
  703. TASM - Table Driven Assembler Version 2.8                    Page 15
  704.  
  705.        Operator    Type            Description
  706.        __________________________________________
  707.        +           Additive        addition
  708.        -                           subtraction
  709.                                    
  710.        *           Multiplicative  multiplication
  711.        /                           division
  712.        %                           modulo
  713.        <<                          logical shift left
  714.        >>                          logical shift right
  715.                                    
  716.        ~           Unary           bit inversion (one's complement)
  717.        -                           unary negation
  718.                                    
  719.        =           Relational      equal
  720.        ==                          equal
  721.        !=                          not equal
  722.        <                           less than
  723.        >                           greater than
  724.        <=                          less than or equal
  725.        >=                          greater than or equal
  726.                                    
  727.        &           Binary          binary 'and'
  728.        |                           binary 'or'
  729.        ^                           binary 'exclusive or'
  730.  
  731. The syntax is much the same as in 'C' with the following notes:
  732.  
  733. 1.  No operator precedence is in effect.  Evaluation is from left to
  734. right unless grouped by  parenthesis (see example below).
  735.  
  736. 2.  All evaluations are done with 32 bit signed precision.
  737.  
  738. 3.  Both  '=' and  '==' are allowable  equality checkers.   This  is
  739. allowed since the syntax does not provide assignment capability  (as
  740. '=' would normally imply).
  741.  
  742. The relational operators return a value of 1 if the relation is true
  743. and 0 if it is false.  Thirtytwo bit signed arithmetic is used.
  744.  
  745. It is always a good idea to explicitly indicate the desired order of
  746. evaluation with  parenthesis,  especially  to  maintain  portability
  747. since  TASM does not evaluate expressions in the same manner as many
  748. other assemblers.  To understand how it does arrive  at  the  values
  749. for expressions, consider the following example:
  750.  
  751.         1 + 2*3 + 4
  752.  
  753. TASM would evaluate this as:
  754.  
  755.        (((1 + 2) * 3) + 4) = 13
  756.  
  757. Typical rules of precedence  would cause the  (2*3) to be  evaluated
  758. first, such as:
  759.  
  760.         1 + (2*3) + 4      = 11
  761. TASM - Table Driven Assembler Version 2.8                    Page 16
  762.  
  763. To  make  sure  you  get  the  desired  order  of  evaluation,   use
  764. parenthesis liberally.
  765.  
  766. Note that  TASM  versions earlier  than  2.7.8 employed  a  somewhat
  767. different method of evaluating expressions (also without precedence)
  768. that essentially resulted in a right to left evaluation.
  769.  
  770. Here are some examples of valid expressions:
  771.  
  772.         (0f800H + tab)
  773.         (label_2 >> 8)
  774.         (label_3 << 8) & $f000
  775.         $ + 4
  776.         010010000100100b + 'a'
  777.         (base + ((label_4 >> 5) & (mask << 2))
  778. TASM - Table Driven Assembler Version 2.8                    Page 17
  779.  
  780. ASSEMBLER DIRECTIVES
  781.  
  782. Most of  the  assembler directives  have  a format  similar  to  the
  783. machine  instruction  format.     However,  instead  of   specifying
  784. operations for the processor to carry out, the directives cause  the
  785. assembler to perform some function related to the assembly  process.
  786. TASM has two types  of assembler directives -  those that mimic  the
  787. 'C'  preprocessor  functions,  and  those  that  resemble  the  more
  788. traditional assembler directive  functions.  Each  of these will  be
  789. discussed.
  790.  
  791. The 'C' preprocessor style directives are invoked with a '#' as  the
  792. first character of  the line followed  by the appropriate  directive
  793. (just as  in 'C').    Thus, these  directives  cannot have  a  label
  794. preceding them  (on the  same  line).   Note  that in  the  examples
  795. directives are shown in upper  case, however, either upper or  lower
  796. case is acceptable.
  797.  
  798. ADDINSTR.  This  directive   can  be  used   to  define   additional
  799. instructions for TASM to use in this assembly.  The format is:
  800.  
  801. [<label>]  .ADDINSTR inst args opcode nbytes modop class shift binor
  802.  
  803. The fields are separated by white space just as they would appear in
  804. an instruction definition  file. See  the TASMTABS.DOC  file on  the
  805. TASM distribution disk for more detail.
  806.  
  807. AVSYM.  See SYM/AVSYM.
  808.  
  809. BLOCK. This directive causes the Instruction Pointer to advance  the
  810. specified number of  bytes without assigning  values to the  skipped
  811. over locations.  The format is:
  812.  
  813.         [label] .BLOCK        expr
  814.  
  815. Some valid examples are:
  816.  
  817.         word1   .BLOCK     2
  818.         byte1   .block     1
  819.         buffer  .block     80
  820.  
  821. BSEG/CSEG/DSEG/NSEG/XSEG.  These  directives   can  be  invoked   to
  822. indicate the  appropriate  address  space  for  symbols  and  labels
  823. defined in the subsequent code.  The invocation of these  directives
  824. in no way affects the code generated, only provides more information
  825. in the  symbol  table  file  if the  AVSYM  directive  is  employed.
  826. Segment control directives such as these are generally supported  by
  827. assemblers that generate  relocatable object  code.   TASM does  not
  828. generate relocatable object code and does not support a link  phase,
  829. so these directives have  no direct effect  on the resulting  object
  830. code. The segments are defined as follows:
  831.  
  832. TASM - Table Driven Assembler Version 2.8                    Page 18
  833.  
  834.         Directive       Segment Description
  835.         _________________________________________________________
  836.         BSEG            Bit  address
  837.         CSEG            Code address
  838.         DSEG            Data address (internal RAM)
  839.         NSEG            Number or constant (EQU)
  840.         XSEG            External data address (external RAM)
  841.  
  842.  
  843. BYTE.  This directive allows a value assignment to the byte  pointed
  844. to by the current Instruction Pointer.  The format is:
  845.  
  846.         [label] .BYTE   expr [, expr ...]
  847.  
  848. Only the lower eight bits of expr  are used.  Multiple bytes may  be
  849. assigned by separating them with  commas or (for printable  strings)
  850. enclosed in double quotes. Here are some examples:
  851.  
  852.  
  853.       label1   .BYTE     10010110B
  854.                .byte     'a'
  855.                .byte     0
  856.                .byte     100010110b,'a',0
  857.                .byte     "Hello", 10, 13, "World"
  858.  
  859.  
  860. CODES/NOCODES. These directives can be  used to alternately turn  on
  861. or off the generation of formatted listing output with line numbers,
  862. opcodes, data, etc.   With NOCODES in effect,  the source lines  are
  863. sent to the listing file untouched.  This is useful around blocks of
  864. comments that need a full 80 columns of width for clarity.
  865.  
  866. DB.  This is alternate form of the BYTE directive.
  867.  
  868. DW.  This is alternate form of the WORD directive.
  869.  
  870. DEFINE. The DEFINE  directive is  one of  the most  powerful of  the
  871. directives and allows  string substitution  with optional  arguments
  872. (macros).  The format is as follows:
  873.  
  874.         #DEFINE  <macro_label>[(<arg_list>)]  [<macro_def>]
  875.  
  876.         <macro_label> := character string to be expanded when found in
  877.                            the source file.
  878.                       
  879.         <arg_list>    := optional argument list for variable
  880.                          substitution in macro expansion.
  881.                       
  882.         <macro_def>   := character string to replace the occurrences
  883.                          of macro_label in the source file.
  884.  
  885. The simplest form of the DEFINE directive might look like this:
  886.  
  887.         #DEFINE         MLABEL
  888.  
  889. Notice that no substitutionary string is specified.  The purpose  of
  890. TASM - Table Driven Assembler Version 2.8                    Page 19
  891.  
  892. a statement like this would typically  be to define a label for  the
  893. purpose of controlling some  subsequent conditional assembly  (IFDEF
  894. or IFNDEF).
  895.  
  896. A more complicated  example, performing  simple substitution,  might
  897. look like this:
  898.  
  899.         #DEFINE         VAR1_LO         (VAR1 & 255)
  900.  
  901. This statement would cause all occurrences of the  string  'VAR1_LO'
  902. in the source to be substituted with '(VAR1 & 255)'.
  903.  
  904. As  a  more  complicated  example,   using  the  argument  expansion
  905. capability, consider this:
  906.  
  907.         #DEFINE         ADD(xx,yy)      clc\ lda xx\ adc yy\ sta xx
  908.  
  909. If the source file then contained a line like this:
  910.  
  911.         ADD(VARX,VARY)
  912.  
  913. It would be expanded to:
  914.  
  915.         clc\ lda VARX\ adc VARY\ sta VARX
  916.  
  917. The above example shows the use of the backslash ('\') character  as
  918. a  multiple  instruction  statement delimiter.  This approach allows
  919. the definition of fairly powerful,  multiple statement  macros.  The
  920. example shown generates 6502 instructions to add one memory location
  921. to another.
  922.  
  923. Some rules associated with the argument list:
  924.  
  925. 1.  Use a maximum of 10 arguments.
  926.  
  927. 2.  Each argument should be a maximum of 15 characters.
  928.  
  929. Note that macros can be defined on the TASM command line, also, with
  930. the '-d' option flag.
  931.  
  932. DEFCONT. This directive can be used to add to the last macro started
  933. with a DEFINE directive.  This  provides a convenient way to  define
  934. long macros without running off the edge of the page. The ADD  macro
  935. shown above could be defined as follows:
  936.  
  937.         #DEFINE         ADD(xx,yy)     clc
  938.         #DEFCONT                     \ lda xx
  939.         #DEFCONT                     \ adc yy
  940.         #DEFCONT                     \ sta xx
  941.  
  942. EJECT.  This  directive  can  be used to force a top of form and the
  943. generation of a page header on the list file.  It has no  effect  if
  944. the paging mode is off (see PAGE/NOPAGE).  The format is:
  945.  
  946.         .EJECT
  947.  
  948. TASM - Table Driven Assembler Version 2.8                    Page 20
  949.  
  950. ELSE.  This directive can optionally be used with IFDEF, IFNDEF  and
  951. IF to delineate an  alternate block of code  to be assembled if  the
  952. block  immediately  following  the  IFDEF,  IFNDEF  or  IF  is   not
  953. assembled.
  954.  
  955. Here are some examples of the use of IFDEF, IFNDEF,  IF,  ELSE,  and
  956. ENDIF:
  957.  
  958.         #IFDEF   label1
  959.         lda      byte1
  960.         sta      byte2
  961.         #ENDIF   
  962.                  
  963.         #ifdef   label1
  964.         lda      byte1
  965.         #else    
  966.         lda      byte2
  967.         #endif   
  968.                  
  969.         #ifndef  label1
  970.         lda      byte2
  971.         #else    
  972.         lda      byte1
  973.         #endif   
  974.  
  975.         #if ($ >= 1000h)
  976.         ; generate an invalid statement to cause an error
  977.         ;  when we go over the 4K boundary.
  978.          !!! PROM bounds exceeded.
  979.         #endif
  980.  
  981. END.     This  directive  should  follow  all  code/data  generating
  982. statements in the  source file.   It forces  the last  record to  be
  983. written to the object file.  The format is:
  984.  
  985.         [<label>]       .END
  986.  
  987. ENDIF. This directive  must always  follow an IFDEF,  IFNDEF, or  IF
  988. directive and signifies the end of the conditional block.
  989.  
  990. EQU. This directive  can be used  to assign values  to labels.   The
  991. labels can  then be  used in  expressions in  place of  the  literal
  992. constant.  The format is:
  993.  
  994.         <label>   .EQU    <expr>
  995.  
  996. Here is an example:
  997.  
  998.         MASK   .EQU   0F0H
  999.         ;             
  1000.                lda    IN_BYTE
  1001.                and    MASK
  1002.                sta    OUT_BYTE
  1003.  
  1004. An alternate  form  of 'EQU'  is   '='.    The previous  example  is
  1005. equivalent to:
  1006. TASM - Table Driven Assembler Version 2.8                    Page 21
  1007.  
  1008.         MASK    =   0F0H
  1009.  
  1010. or
  1011.  
  1012.         MASK    =0FOH
  1013.         MASK    =$FO
  1014.  
  1015. White space must exist after the label,  but none is required  after
  1016. the '='.
  1017.  
  1018. EXPORT. This directive can be  used to define labels (symbols)  that
  1019. are to  be written  to the  export  symbol file.   The  symbols  are
  1020. written as equates (using the .EQU directive) so that the  resulting
  1021. file can be  included in a  subsequent assembly.   This feature  can
  1022. help overcome some of the deficiencies of TASM due to its lack of  a
  1023. relocating linker. The format is:
  1024.  
  1025. [<label>]  .EXPORT      <label >
  1026.  
  1027. The following example  illustrates the use  of the EXPORT  directive
  1028. and the format of the resulting export file:
  1029.  
  1030. Source file:
  1031.  
  1032.         .EXPORT        read_byte
  1033.         .EXPORT        write_byte
  1034.         .EXPORT        open_file
  1035.  
  1036. Resulting export file:
  1037.  
  1038. read_byte      .EQU   $1243
  1039. write_byte     .EQU   $12AF
  1040. open_file      .EQU   $1301
  1041.  
  1042.  
  1043. IFDEF. This directive can be used to optionally assemble a block  of
  1044. code.  It has the following form:
  1045.  
  1046.         #IFDEF  <macro_label>
  1047.  
  1048. When invoked,  the  list of  macro  labels (established  via  DEFINE
  1049. directives) is searched.  If the label is found, the following lines
  1050. of code are  assembled.   If not found,  the input  file is  skipped
  1051. until an ENDIF or ELSE directive is found.
  1052.  
  1053. Lines that are skipped over still appear in the listing file, but  a
  1054. '~' will appear immediately after the current PC and no object  code
  1055. will be generated (this is applicable to IFDEF, IFNDEF, and IF).
  1056.  
  1057. IFNDEF. This directive is the opposite of the IFDEF directive.   The
  1058. block  of  code  following  is  assembled  only  if  the   specified
  1059. macro_label is undefined.  It has the following form:
  1060.  
  1061.         #IFNDEF  <macro_label>
  1062.  
  1063. When invoked,  the  list of  macro  labels (established  via  DEFINE
  1064. TASM - Table Driven Assembler Version 2.8                    Page 22
  1065.  
  1066. directives) is searched.  If the  label is not found, the  following
  1067. lines of code  are assembled.   If it  is found, the  input file  is
  1068. skipped until an ENDIF or ELSE directive is found.
  1069.  
  1070. IF.  This directive  can be used to  optionally assemble a block  of
  1071. code dependent on the value of a given expression.  The format is as
  1072. follows:
  1073.  
  1074.         #IF     <expr>
  1075.  
  1076. If the expression <expr> evaluates to non-zero, the following  block
  1077. of code is assembled (until an ENDIF or ELSE is encountered).
  1078.  
  1079. INCLUDE.  The INCLUDE directive reads in and assembles the indicated
  1080. source file.  INCLUDEs can be nested up to six levels.  This  allows
  1081. a convenient  means to  keep  common definitions,  declarations,  or
  1082. subroutines in files  to be included  as needed.   The format is  as
  1083. follows:
  1084.  
  1085.         #INCLUDE        "<filename>"
  1086.  
  1087. The <filename> must  be enclosed in  double quotes.   Here are  some
  1088. examples:
  1089.  
  1090.         #INCLUDE       "macros.h"
  1091.         #include       "equates"
  1092.         #include       "subs.asm"
  1093.  
  1094. LIST/NOLIST.  These directives can  be used to alternately turn  the
  1095. output to the list file on (LIST) or off (NOLIST).  The format is:
  1096.  
  1097.         .LIST
  1098.         .NOLIST
  1099.  
  1100. LSFIRST/MSFIRST. These directives determine  the byte order rule  to
  1101. be employed for the WORD directive.  The default (whether correct or
  1102. not) for  all TASM  versions  is the  least significant  byte  first
  1103. (LSFIRST).  The following illustrates its effect:
  1104.  
  1105.         0000  34 12    .word $1234
  1106.         0002           .msfirst
  1107.         0002  12 34    .word $1234
  1108.         0004           .lsfirst
  1109.         0004  34 12    .word $1234
  1110.  
  1111.  
  1112. ORG. This  directive  provides  the means  to  set  the  Instruction
  1113. Pointer (a.k.a. Program Counter) to  the desired value.  The  format
  1114. is:
  1115.  
  1116.         [<label>] .ORG    <expr>
  1117.  
  1118. The <label> is optional.   The Instruction  pointer is assigned  the
  1119. value of  the expression,  <expr>.   For example,  to generate  code
  1120. starting at address 1000H, the following could be done:
  1121.  
  1122. TASM - Table Driven Assembler Version 2.8                    Page 23
  1123.  
  1124.         start   .ORG    1000H
  1125.  
  1126. The expression  (<expr>)  may  contain  references  to  the  current
  1127. Instruction Pointer, thus allowing various manipulations to be done.
  1128. For example, to align the Instruction  Pointer on the next 256  byte
  1129. boundary, the following could be done:
  1130.  
  1131.                 .ORG  (($ + 0FFH) & 0FF00H)
  1132.  
  1133. ORG can also be used to reserve space without assigning values:
  1134.  
  1135.                .ORG    $+8
  1136.  
  1137. An alternate form of ORG  is '*=' or '$='.   Thus the following  two
  1138. examples are exactly equivalent to the previous example:
  1139.  
  1140.                 *=*+8
  1141.                 $=$+8
  1142.  
  1143. PAGE/NOPAGE.  These directives can  be used to alternately turn  the
  1144. paging mode on (PAGE) or off (NOPAGE).  If paging is in effect, then
  1145. every sixty  lines of  output will  be  followed by  a Top  of  Form
  1146. character and a  two line header  containing page number,  filename,
  1147. and the title.  The format is:
  1148.  
  1149.         .PAGE
  1150.         .NOPAGE
  1151.  
  1152. The number of lines per page can  be set with the '-p' command  line
  1153. option.
  1154.  
  1155.  
  1156. SET. This directive  allows the  value of  an existing  label to  be
  1157. changed.  The format is:
  1158.  
  1159.         <label>   .SET    <expr>
  1160.  
  1161. The use of the  SET directive should be  avoided since changing  the
  1162. value of a label can sometimes cause phase errors between pass 1 and
  1163. pass 2 of the assembly.
  1164.  
  1165. SYM/AVSYM. These directives can be used to cause a symbol table file
  1166. to be generated.  The format is:
  1167.  
  1168.         .SYM    ["<symbol_filename>"]
  1169.         .AVSYM  ["<symbol_filename>"]
  1170.  
  1171. For example:
  1172.  
  1173.         .SYM       "symbol.map"
  1174.         .SYM       
  1175.         .AVSYM     "prog.sym"
  1176.         .AVSYM
  1177.  
  1178. The two directives are similar, but result in a different format  of
  1179. the symbol table file.  The format  of the SYM file is one line  per
  1180. TASM - Table Driven Assembler Version 2.8                    Page 24
  1181.  
  1182. symbol, each symbol starts  in the first column  and is followed  by
  1183. white space and then four hexadecimal digits representing the  value
  1184. of the symbol.  The following illustrates the format:
  1185.  
  1186.        label1         FFFE
  1187.        label2         FFFF
  1188.        label3         1000
  1189.  
  1190. The AVSYM is provided to generate symbol tables compatible with  the
  1191. Avocet 8051 simulator.   The  format is  similar, but  each line  is
  1192. prefixed by an 'AS' and each  symbol value is prefixed by a  segment
  1193. indicator:
  1194.  
  1195.         AS     start          C:1000
  1196.         AS     read_byte      C:1243
  1197.         AS     write_byte     C:1280
  1198.         AS     low_nib_mask   N:000F
  1199.         AS     buffer         X:0080
  1200.  
  1201. The segment  prefixes  are determined  by  the most  recent  segment
  1202. directive invoked (see BSEG/CSEG/DSEG/NSEG/XSEG directives).
  1203.  
  1204. TEXT. This directive  allows an ASCII  string to be  used to  assign
  1205. values  to  a  sequence  of   locations  starting  at  the   current
  1206. Instruction Pointer.  The format is:
  1207.  
  1208.         [<label>] .TEXT   "<string>"
  1209.  
  1210. The ASCII value of each character in string is taken and assigned to
  1211. the next sequential location.   Some escape sequences are  supported
  1212. as follows:
  1213.  
  1214.         Escape
  1215.         Sequence       Description
  1216.         ___________________________________________________
  1217.         \n             Line Feed
  1218.         \r             Carriage return
  1219.         \b             Backspace
  1220.         \t             Tab
  1221.         \f             Formfeed
  1222.         \\             Backslash
  1223.         \"             Quote
  1224.         \000           Octal value of character
  1225.  
  1226. Here are some examples:
  1227.  
  1228.         message1   .TEXT   "Disk I/O error"
  1229.         message2   .text   "Enter file name "
  1230.                    .text   "abcdefg\n\r"
  1231.                    .text   "I said \"NO\""
  1232.  
  1233.  
  1234. TITLE.  This directive allows the user to define a title string that
  1235. appears at the top of each page of the list file (assuming the  PAGE
  1236. mode is on).  The format is:
  1237.  
  1238. TASM - Table Driven Assembler Version 2.8                    Page 25
  1239.  
  1240.                 .TITLE  "<string>"
  1241.  
  1242. The string should not exceed 80 characters.  Here are some examples:
  1243.  
  1244.                 .TITLE  "Controller version 1.1"
  1245.                 .title  "This is the title of the assembly"
  1246.                 .title  ""
  1247.  
  1248. WORD. This directive allows a value assignment to the next two bytes
  1249. pointed to by the current Instruction Pointer.  The format is:
  1250.  
  1251.         [<label>] .WORD  <expr> [, <expr> ...]
  1252.  
  1253. The  least  significant  byte  of  <expr>  is  put  at  the  current
  1254. Instruction Pointer  with  the most  significant  byte at  the  next
  1255. sequential location (unless the MSFIRST directive has been invoked).
  1256. Here are some examples:
  1257.  
  1258.         data_table     .WORD   (data_table + 1)
  1259.                        .word   $1234
  1260.                        .Word   (('x' - 'a')  << 2)
  1261.                        .Word   12, 55, 32
  1262.  
  1263. TASM - Table Driven Assembler Version 2.8                    Page 26
  1264.  
  1265. OBJECT FILE FORMATS
  1266.  
  1267. TASM supports four object file formats:
  1268.  
  1269.         1.  Intel Hex (default).
  1270.         2.  MOS Technology Hex.
  1271.         3.  Motorola Hex.
  1272.         4.  Binary
  1273.  
  1274. Each are described below:
  1275.  
  1276. Intel Hex Object Format. This is the default format.  This format is
  1277. line oriented and  uses only printable  ASCII characters except  for
  1278. the carriage return/line feed at the end of each line.  Each line in
  1279. the file assumes the following format:
  1280.  
  1281. :NNAAAARRHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHCCTT
  1282.  
  1283. Where:
  1284.  
  1285. All fields marked  'hex' consist  of two or  four ASCII  hexadecimal
  1286. digits (0-9, A-F).  A maximum  of 24 data bytes will be  represented
  1287. on each line  (override the 24  byte default with  the '-o'  command
  1288. line option).
  1289.  
  1290. :      = Record Start Character
  1291. NN     = Byte Count (hex)
  1292. AAAA   = Address of first byte (hex)
  1293. RR     = Record Type (hex, 00 except for last record which is 01)
  1294. HH     = Data Bytes (hex)
  1295. CC     = Check Sum (hex)
  1296. TT     = Line Terminator (carriage return, line feed)
  1297.  
  1298. The last line of the file will  be a record conforming to the  above
  1299. format with a byte count of zero:
  1300.  
  1301.          :00000001FF
  1302.  
  1303. The checksum is defined as:
  1304.  
  1305. sum = byte_cnt+addr_hi+addr_lo+rec_type + (sum of all data bytes)
  1306. checksum =  ((-sum) & ffh)
  1307. TASM - Table Driven Assembler Version 2.8                    Page 27
  1308.  
  1309. MOS Technology Hex Object Format.  This format is line oriented  and
  1310. uses  only  printable  ASCII  characters  except  for  the  carriage
  1311. return/line feed at the  end of each  line.  Each  line in the  file
  1312. assumes the following format:
  1313.  
  1314. ;NNAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHCCCCTT
  1315.  
  1316. All fields marked  'hex' consist  of two or  four ASCII  hexadecimal
  1317. digits (0-9, A-F).  A maximum  of 24 data bytes will be  represented
  1318. on each line  (override the 24  byte default with  the '-o'  command
  1319. line option).
  1320.  
  1321. ;      = Record Start Character
  1322. NN     = Byte Count (hex)
  1323. AAAA   = Address of first byte (hex)
  1324. HH     = Data Bytes (hex)
  1325. CCCC   = Check Sum (hex)
  1326. TT     = Line Terminator (carriage return, line feed)
  1327.  
  1328. The last line of the file will be a record with a byte count of zero
  1329. (';00').
  1330.  
  1331. The checksum is defined as:
  1332.  
  1333. sum = byte_cnt+addr_hi+addr_lo+rec_type + (sum of all data bytes)
  1334. checksum =  (sum & ffffh)
  1335.  
  1336.  
  1337. Motorola Hex Object Format.  This format is  line oriented and  uses
  1338. only printable ASCII characters except for the carriage  return/line
  1339. feed at the end  of each line.   Each line in  the file assumes  the
  1340. following format:
  1341.  
  1342. S1NNAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHCCCCTT
  1343.  
  1344. All fields marked  'hex' consist  of two or  four ASCII  hexadecimal
  1345. digits (0-9, A-F).  A maximum  of 24 data bytes will be  represented
  1346. on each line  (override the 24  byte default with  the '-o'  command
  1347. line option).
  1348.  
  1349. S1     = Record Start Prefix
  1350. NN     = Byte Count (hex) (data byte count + 3)
  1351. AAAA   = Address of first byte (hex)
  1352. HH     = Data Bytes (hex)
  1353. CC     = Check Sum (hex)
  1354. TT     = Line Terminator (carriage return, line feed)
  1355.  
  1356. The last line of the file will be a record with a byte count of zero
  1357. ('S903AAAACCTT'). The checksum is defined as:
  1358.  
  1359. sum = byte_cnt+addr_hi+addr_lo+rec_type + (sum of all data bytes)
  1360. checksum =  (~sum & ffh)
  1361.  
  1362.  
  1363. Binary  Object  Format.   This  file  format   has  only  a   binary
  1364. representation of each data byte with no address, checksum or format
  1365. TASM - Table Driven Assembler Version 2.8                    Page 28
  1366.  
  1367. description, whatsoever.  It is often a convenient format to use  to
  1368. pass the data to other programs  on your PC (like a PROM  programmer
  1369. package) but because  of the  non-printability and  lack of  address
  1370. information, it is  not often  used to  transmit the  code to  other
  1371. systems.
  1372.  
  1373. Note that when this  object format is selected  (-b option), the  -c
  1374. option is forced.   This is done  so that no  ambiguity arises as  a
  1375. result of the lack of address information in the file.  Without  the
  1376. -c  option,  discontinuous  blocks  of  object  code  would   appear
  1377. contiguous.
  1378.  
  1379. TASM - Table Driven Assembler Version 2.8                    Page 29
  1380.  
  1381. LISTING FILE FORMAT
  1382.  
  1383. Each line of source code generates one (or more) lines of output  in
  1384. the listing file.  The fields of the output line are as follows:
  1385.  
  1386. 1.  Current  source  file  line  number  (4 decimal digits).
  1387.  
  1388. 2.  An optional '+'  appears if this is   an  'INCLUDE'  file.  (One
  1389. '+' for each level of INCLUDE invoked).
  1390.  
  1391. 3.  Current  Instruction Pointer (4  hex digits).   An optional  '~'
  1392. follows the Instruction Pointer  if the line of  source code is  not
  1393. being assembled because of an IFDEF, IFNDEF, or IF directive.
  1394.  
  1395. 4.  Resulting  code/data generated  from this source  line (two  hex
  1396. digits per byte, each byte separated by a space, up to six bytes per
  1397. line).
  1398.  
  1399. 5.  The source line exactly as it appears in the source file.
  1400.  
  1401. If  paging  is  enabled (by either the '-p' option flag or the .PAGE
  1402. directive) some additional fields will be inserted into the  listing
  1403. file every 60 lines.  These fields are:
  1404.  
  1405.         1.  Top of Form (form feed).
  1406.         2.  Assembler identifier (e.g. "TASM 6502 Assembler").
  1407.         3.  Initial source file name.
  1408.         4.  Page number.
  1409.         5.  Title.
  1410. TASM - Table Driven Assembler Version 2.8                    Page 30
  1411.  
  1412. PROM PROGRAMMING
  1413.  
  1414. A wide variety of PROM  programming equipment is available that  can
  1415. use object code in one or more  of the formats TASM supports.   Here
  1416. are some notes concerning the generation of code to be put in PROMs:
  1417.  
  1418. 1.  PRESET MEMORY.  It is often  desirable to have all bytes in  the
  1419. PROM programmed  even if  not  explicitly assigned  a value  in  the
  1420. source  code  (e.g.    the  bytes  are  skipped  over  with  a  .ORG
  1421. statement).  This can  be accomplished by  using the -c  (contiguous
  1422. block) and the  -f (fill) command  line option flags.   The -c  will
  1423. ensure that every byte from the lowest byte assigned a value to  the
  1424. the highest byte assigned a value will be in the object file with no
  1425. gaps.  The  -f flag  will assign the  specified value  to all  bytes
  1426. before the assembly begins so that when the object file is  written,
  1427. all bytes not assigned a value in the source code will have a  known
  1428. value.   As an  example, the  following command  line will  generate
  1429. object code  in the  default Intel  Hex format  with all  bytes  not
  1430. assigned a value in the source set to EA (hex, 6502 NOP):
  1431.  
  1432.                 tasm -65 -c -fEA test.asm
  1433.  
  1434. 2.  CONTIGUOUS BLOCKS.  To ensure that TASM generates object code to
  1435. cover the  full  address  range  of the  target  PROM,  put  a  .ORG
  1436. statement at the  end of  the source file  set to  the last  address
  1437. desired.  For example, to generate code to be put in a 2716 EPROM (2
  1438. Kbytes) from hex address $1000 to  $17ff, do something like this  in
  1439. the source file:
  1440.  
  1441.                          ;start of the file
  1442.                          .ORG    $1000
  1443.                          ;rest of the source code follows
  1444.  
  1445.                          <source code>
  1446.  
  1447.                          ;end of the source code
  1448.                          .ORG    $17ff
  1449.                          .BYTE   0
  1450.                          .END
  1451.  
  1452. Now, to invoke TASM to generate  the code in the binary format  with
  1453. all unassigned bytes set to 00 (6502 BRK), do the following:
  1454.  
  1455.                 tasm -65 -b -f00 test.asm
  1456.  
  1457. Note that -b forces the -c option.
  1458.  
  1459. TASM - Table Driven Assembler Version 2.8                    Page 31
  1460.  
  1461. ERROR MESSAGES
  1462.  
  1463.  
  1464. ERROR MESSAGE                             DESCRIPTION
  1465. _______________________________________________________________________
  1466. Unrecognized directive                    A statement  starting with  a
  1467.                                           '.' or  '#'  has  a  mnemonic
  1468.                                           that  is  not  defined  as  a
  1469.                                           directive.
  1470.  
  1471. Unrecognized  instruction                 A  statement  has  an  opcode
  1472.                                           mnemonic that is not defined.
  1473.  
  1474. Unrecognized argument                     A statement has  an   operand
  1475.                                           format that is not defined.
  1476.  
  1477. Label value misaligned                    The value of a label  appears
  1478.                                           to have a different value  on
  1479.                                           the second pass  then it  was
  1480.                                           computed to have on the first
  1481.                                           pass.  This is generally  due
  1482.                                           to Zero Page Addressing  mode
  1483.                                           problems   with   the    6502
  1484.                                           version of TASM.  Labels that
  1485.                                           are  used  in  operands   for
  1486.                                           statements that could utilize
  1487.                                           Zero  Page  addressing   mode
  1488.                                           should  always   be   defined
  1489.                                           before used as an operand.
  1490.  
  1491. Label table overflow                      To  many  labels  have   been
  1492.                                           encountered.
  1493.  
  1494. No END directive before EOF               The source file did not  have
  1495.                                           an END directive in it.  This
  1496.                                           is not fatal,  but may  cause
  1497.                                           the last  object file  record
  1498.                                           to be lost.
  1499.  
  1500. No  files  specified                      TASM  was  invoked  with   no
  1501.                                           source file specified.
  1502.  
  1503. Unknown  option  flag                     TASM  was  invoked  with   an
  1504.                                           undefined option flag on  the
  1505.                                           command line.
  1506.  
  1507. Source file open error                    TASM was not able to open the
  1508.                                           specified source file.
  1509.  
  1510. List file open error                      TASM was not able to open the
  1511.                                           specified list file.
  1512.  
  1513. Object file open error                    TASM was not able to open the
  1514.                                           specified object file.
  1515.  
  1516. Unknown token                             Unexpected  characters   were
  1517. TASM - Table Driven Assembler Version 2.8                    Page 32
  1518.  
  1519.                                           encountered while parsing  an
  1520.                                           expression.
  1521.  
  1522. maximum number of macros exceeded         To many macros (DEFINEs) have
  1523.                                           been encountered.
  1524.  
  1525. macro buffer overflow                     The buffer  from which  space
  1526.                                           is   allocated   for    macro
  1527.                                           definitions is exhausted.
  1528.  
  1529. range of relative branch exceeded         A branch instruction  exceeds
  1530.                                           the   maximum   range   (6502
  1531.                                           Version).
  1532.  
  1533. macro expansion too long.                 The  expansion  of  a   macro
  1534.                                           resulted  in   a  line   that
  1535.                                           exceeded the maximum length.
  1536.  
  1537. Heap overflow on label definition.        TASM was  unable to  allocate
  1538.                                           memory to store the label.
  1539.  
  1540. No such label yet defined.                A    SET    directive     was
  1541.                                           encountered for  a label  not
  1542.                                           yet defined.   The  value  of
  1543.                                           labels that  are modified  by
  1544.                                           the   SET   directive    must
  1545.                                           already exist.
  1546.  
  1547. No indirection for this instruction.      A   parenthesis   was   found
  1548.                                           around      the       operand
  1549.                                           expression. This may indicate
  1550.                                           an attempt to use indirection
  1551.                                           where it is inappropriate.
  1552.  
  1553. Non-unary operator at start of expression A non-unary  operator at  the
  1554.                                           beginning of an expression is
  1555.                                           invalid.
  1556.  
  1557. Binary operator where value expected.     Two binary operators in a row
  1558.                                           indicate a missing value.
  1559.  
  1560. Invalid token where value expected.       Two binary operators in a row
  1561.                                           are not allowed.
  1562.  
  1563. Duplicate label.                          Duplicate  label  checks  are
  1564.                                           optionally enabled by the  '-
  1565.                                           a' option.
  1566.  
  1567. Label must pre-exist for SET.             The SET directive can only be
  1568.                                           applied to an existing label.
  1569.  
  1570. Unused data in MS byte of argument.       An instruction  or  directive
  1571.                                           used  the  least  significant
  1572.                                           byte of an argurment and left
  1573.                                           the  most  significant   byte
  1574.                                           unused, but it was non-zero.
  1575. TASM - Table Driven Assembler Version 2.8                    Page 33
  1576.  
  1577. File name too short                       A file  name on  the  command
  1578.                                           line   is   fewer   than    3
  1579.                                           characters. This  is done  to
  1580.                                           prevent a garbled option flag
  1581.                                           from being taken as a  source
  1582.                                           file,  which   in  turn   can
  1583.                                           result  in  the  source  file
  1584.                                           taken  as   an  object   file
  1585.                                           (which   are   truncated   at
  1586.                                           start-up time).
  1587.  
  1588. Unkown option Flag.                       Invalid option flag has  been
  1589.                                           specified  on   the   command
  1590.                                           line.     invoke  TASM   with
  1591.                                           nothing on  the command  line
  1592.                                           to  see  a   list  of   valid
  1593.                                           options.
  1594.  
  1595. TASM - Table Driven Assembler Version 2.8                    Page 34
  1596.  
  1597. BUGS AND LIMITATIONS
  1598.  
  1599. Limitations and Specifications
  1600. _____________________________________________________________________
  1601. Maximum number of labels                   2000
  1602. Maximum length of labels                   13 characters
  1603. Maximum address space                      64 Kbytes (65536 bytes)
  1604. Maximum number of nested INCLUDES          4
  1605. Maximum length of TITLE string             79 characters
  1606. Maximum source line length                 255 characters
  1607. Maximum length after macro expansion       255 characters
  1608. Maximum length of expressions              255 characters
  1609. Maximum length of pathnames                79 characters
  1610. Maximum length of command line             127 characters
  1611.                                            
  1612. Maximum number of instructions (per table) 600
  1613. Maximum number of macros                   1000
  1614. Maximum number of macro arguments          10
  1615. Maximum length of macro argument           16 characters
  1616. Heap size (for labels, macros, & buffers)  20000 bytes
  1617. Memory requirements                        160K
  1618.  
  1619. Bugs
  1620.  
  1621. 1.  The 8048 version of TASM does not check for use of memory beyond
  1622. any reasonable bounds (e.g.  an 8048 has a maximum address space  of
  1623. 4 Kbytes but TASM will let you pretend that you have 64 Kbytes).
  1624.  
  1625. 2.  Expression evaluation has no operator precedence in effect which
  1626. can  make   for  unexpected results  if not explicitly grouped  with
  1627. parenthesis.
  1628.  
  1629. 3.  First page of  listing file will not  show a user defined  title
  1630. (defined via TITLE directive).
  1631.  
  1632. 4.  TASM sometimes does not generate error messages  for  improperly
  1633. formed expressions.
  1634.  
  1635. 5.  TASM does not generate an error message when a EQU directive has
  1636. an undefined label on the right hand side.
  1637.  
  1638. TASM - Table Driven Assembler Version 2.8                    Page 35
  1639.  
  1640. APPENDIX A - ORDERING INFORMATION
  1641.  
  1642. TASM is  distributed as  shareware.   The shareware  portion of  the
  1643. product may be freely copied and used for evaluation purposes.   Use
  1644. of  TASM  beyond   an  evaluation   period  of   90  days   requires
  1645. registration. Registered users receive the following benefits:
  1646.  
  1647.     1.  The recent version of TASM.
  1648.     2.  TASM source code (in C).
  1649.     3.  Bound TASM manual.
  1650.     4.  Telephone support.
  1651.     5.  Knowledge that they are supporting the development of useful
  1652.         but inexpensive software.
  1653.  
  1654. DESCRIPTION                                  UNIT PRICE    PRICE
  1655. ____________________________________________________________________
  1656.  
  1657. TASM Registration (TASM disk, manual, & source)  $40.00    _______
  1658.  
  1659. TASM Site Registration (for sites with multiple   90.00    _______
  1660.    users.  Includes same materials as above.)          
  1661.  
  1662. TASM User's Manual (included above)               10.00    _______
  1663.  
  1664. TASM update for registered users                  10.00    _______
  1665.    (latest disk (with source), and manual)             
  1666.  
  1667. Subtotal                                                   _______
  1668.  
  1669. Tax (Washington state residents add 8.1%)                  _______
  1670.  
  1671. Billing fee (for orders not accompanied by check) 10.00    _______
  1672.  
  1673. Foreign postage (outside North America) add $10.00         _______
  1674.   (Foreign orders must be in US funds drawn on a US bank)
  1675.  
  1676. TOTAL (post paid)                                          _______
  1677.  
  1678.  
  1679. Which processors are of primary interest to you?  __________________
  1680. (This is for information only.  You will receive all current tables).
  1681.  
  1682. Shipping Address:
  1683.  
  1684. ______________________________________________
  1685.  
  1686. ______________________________________________
  1687.  
  1688. ______________________________________________
  1689.  
  1690. Send check or money order to:
  1691.  
  1692.     Speech Technology Incorporated
  1693.     Software Division
  1694.     837 Front Street South
  1695.     Issaquah, WA  98027   USA
  1696.  
  1697.